package com.dm.library.widgets.viewpager;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * 版    权:  深圳市迪蒙网络科技有限公司
 * 描    述:  不可滑动ViewPager
 * Created by tangjian on 2016/11/14.
 */

public class HomeUseViewPager extends LazyViewPager {
    private boolean scrollable = false;

    public HomeUseViewPager(Context context) {
        super(context);
    }

    public HomeUseViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (!scrollable) {
            return false;
        }
        return super.onTouchEvent(ev);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (!scrollable) {
            return false;
        }
        return super.onInterceptTouchEvent(ev);
    }

    public boolean isScrollable() {
        return scrollable;
    }

    public void setScrollable(boolean scrollble) {
        this.scrollable = scrollble;
    }
}
